package edu.nf.ch05.common.resultvo;

import lombok.Data;

/**
 * @Author gjh
 * @Date 2025/9/17
 * @Description:
 */
@Data
public class ResultVO<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> ResultVO<T> success(T data) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(200);
        vo.setData(data);
        return vo;
    }

    public static <T> ResultVO<T> success() {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(200);
        return vo;
    }

    public static <T> ResultVO<T> error(Integer code, String msg) {
        ResultVO<T> vo = new ResultVO<>();
        vo.setCode(code);
        vo.setMessage(msg);
        return vo;
    }
}
